//
//  IndexPathRange.h
//  MyFunctionDemo
//
//  Created by Ting Han on 2017/9/22.
//  Copyright © 2017年 Ting Han. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface IndexPathRange : NSObject
//section
@property (nonatomic) NSUInteger section;
//row,从哪个位置开始
@property (nonatomic) NSUInteger location;
//Range的长度是多少 row的范围是location...location+length
@property (nonatomic) NSUInteger length;

+ (NSMutableArray <NSIndexPath *> *)indexPathsFromIndexPathRanges:(NSArray <IndexPathRange *> *)indexPathRanges;


@end

NS_INLINE  IndexPathRange * MakeIndexPathRange(NSUInteger section ,NSUInteger location,NSUInteger length){
    IndexPathRange *r = [IndexPathRange new];
    r.section    = section;
    r.location      = location;
    r.length     = length;
    return r;
}
NS_INLINE NSMutableArray <NSIndexPath *> * MakeIndexPathRanges(NSArray <IndexPathRange *> *indexPathRanges) {
    return [IndexPathRange indexPathsFromIndexPathRanges:indexPathRanges];
}
